home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 814 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. From: beman@dawes.win.net (Beman Dawes)
  2. Message-ID: <1278@dawes.win.net>
  3. X-Original-Date: Thu, 21 Mar 1996 15:42:03
  4. Path: in1.uu.net!bounce-back
  5. Date: 22 Mar 96 02:04:09 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Organization: -
  8. Newsgroups: comp.std.c++
  9. X-Mailer: WinNET Mail, v2.61
  10. Reply-To: beman@dawes.win.net (Beman Dawes)
  11. Subject: Re: A couple of questions about strings
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMVIKouEDnX0m9pzZAQFWVQF9ERNwUD8HTptjPwhjQwPX8JqptBPT2lFl
  14.     lorPEhbo+ORFTJZ3Z4uVi9cGuQqOdyGV
  15.     =ncyd
  16.  
  17.  
  18. >I'm probably beating a dead horse here, but I had a couple of
  19. >questions about the strings class (at least, the one in the April WP).
  20. >Specifically, there are two design decisions that I don't understand.
  21. >
  22. >a) Why does basic_string::copy() not also copy an ending '\0'? If
  23. >there's some sort of good reason, why wasn't a function added that did
  24. >this (perhaps basic_string::copy_null() or something)? I must say, it
  25. >is very inconvenient to copy a string to a C-style array of chars with
  26. >the current string class.
  27.  
  28. There is such a function - it is called c_str().
  29.  
  30. >b) I don't see any reason why basic_string::copy() is not a const
  31. >function. Any particular reason for that one?
  32.  
  33. copy() is const in the current WP.
  34.  
  35.  
  36. --Beman Dawes
  37. ---
  38. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  39. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  40. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  41. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  42. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  43.